********************************************************************************
*
*	The Strategic Logic of Large Militant Alliance Networks
*   Potter and Blair
*
*
********************************************************************************

clear all

** Set Working Directory

if c(username) == "christopherblair"{
global dir "~/Dropbox/ISIL-AQ Networks/Data"  // CWB's Directory												
}

else if c(username) == "youruser"{
global dir "~/Dropbox/ISIL-AQ Networks/Data"  // YOUR Directory
}

cd "~/Dropbox/ISIL-AQ Networks/Data/"


********************************************************************************

*** AQ ALLIANCES FIGURE

use "aqis_mgar.dta", clear

tab contentordermiss0, gen(cont)
tab typeordermiss0, gen(type)

keep if alqaeda==1

collapse (sum) alliance type2 type3 cont2 cont3, by(year)

tw (line alliance year, lcolor(black) lpatt(solid)) || (line type2 year, lcolor(gs10) lpatt(solid)) || (line type3 year, lcolor(black) lpatt(shortdash)), legend(off) xlabel(1988(2)2016, tlength(*1.45)) xmtick(1988(1)2016, tlength(*1.75)) ylabel(0(10)40, tlength(*1.45)) ymtick(0(5)40, tlength(*1.75)) ytitle("# of Alliances") text(34 2015 "Alliances", size(small)) text(16 2015 "Material", size(small)) text(7 2015 "Rhetorical", size(small)) xline(1992, lcolor(cranberry) lpatt(shortdash)) xline(2001, lcolor(cranberry) lpatt(shortdash)) xline(2013, lcolor(cranberry) lpatt(shortdash)) title("al-Qaeda Alliance Network", margin(medlarge)) text(42 1992 "First Attack", size(small)) text(42 2001 "9/11", size(small)) text(42 2013 "Rise of IS", size(small))

*** IS ALLIANCES FIGURE

use "aqis_mgar.dta", clear

tab contentordermiss0, gen(cont)
tab typeordermiss0, gen(type)

keep if isis==1

collapse (sum) alliance type2 type3 cont2 cont3, by(year)

tw (line alliance year if year>=2013, lcolor(black) lpatt(solid)) || (line type2 year if year>=2013, lcolor(gs10) lpatt(solid)) || (line type3 year if year>=2013, lcolor(black) lpatt(shortdash)), legend(off) xlabel(2013(1)2016, tlength(*1.45)) ylabel(0(5)40, tlength(*1.45)) ymtick(0(1)40, tlength(*1.75)) ytitle("# of Alliances") text(32.5 2015.8 "Alliances", size(small)) text(17 2015.8 "Material", size(small)) text(7.9 2015.5 "Rhetorical", size(small)) xline(2014, lcolor(cranberry) lpatt(shortdash)) xline(2015, lcolor(cranberry) lpatt(shortdash)) title("Islamic State Alliance Network", margin(medlarge)) text(42 2014 "Split with AQ", size(small)) text(42 2015 "Expansion", size(small))


********************************************************************************


use "aqis_mgar.dta", clear


*** DIFFERENCES-IN-MEANS

ttest sharedideo if alliance==1 & drop==0, by(isis)
cibar sharedideo if alliance==1 & drop==0, over(isis) level(95) ciopts(lcolor(cranberry)) baropts(lcolor(gs3)) barcolor(gs12 white) graphopts(legend(off) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) ytitle("Shared Ideology") text(.05 1 "AQ", size(medsmall)) text(.05 2 "IS", size(medsmall)) text(.97 1.5 "P-Value = 0.0987", size(medsmall)) yline(1, lcolor(gs10) lpatt(dot)) caption(" ", size(medsmall)))

ttest attackdiff if alliance==1 & drop==0, by(isis)
cibar attackdiff if alliance==1 & drop==0, over(isis) level(95) ciopts(lcolor(cranberry)) baropts(lcolor(gs3)) barcolor(gs12 white) graphopts(legend(off) ylabel(0(200)1400, tlength(*1.45)) ymtick(0(100)1400, tlength(*1.75)) yline(1400, lcolor(gs10) lpatt(dot)) ytitle("Relative Capacity: # of Attacks") text(.05 1 "AQ", size(medsmall)) text(.05 2 "IS", size(medsmall)) text(.97 1.5 "Diff = 1134.163; P-Value = <.0001", size(medsmall)) yline(1, lcolor(gs10) lpatt(dot)) caption(" ", size(medsmall)))

ttest tacticdiff if alliance==1 & drop==0, by(isis)
cibar tacticdiff if alliance==1 & drop==0, over(isis) level(95) ciopts(lcolor(cranberry)) baropts(lcolor(gs3)) barcolor(gs12 white) graphopts(legend(off) ylabel(0(1)8, tlength(*1.45)) ymtick(0(1)8, tlength(*1.75)) yline(8, lcolor(gs10) lpatt(dot)) ytitle("Relative Capacity: # of Tactics") text(.05 1 "AQ", size(medsmall)) text(.05 2 "IS", size(medsmall)) text(.97 1.5 "Diff = 5.00; P-Value = <.0001", size(medsmall)) yline(1, lcolor(gs10) lpatt(dot)) caption(" ", size(medsmall)))

ttest opsupp0 if alliance==1 & drop==0, by(isis)
cibar opsupp0 if alliance==1 & drop==0, over(isis) level(95) ciopts(lcolor(cranberry)) baropts(lcolor(gs3)) barcolor(gs12 white) graphopts(legend(off) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) ytitle("Operational Support") text(.05 1 "AQ", size(medsmall)) text(.05 2 "IS", size(medsmall)) text(.97 1.5 "Diff.= 0.18; P-value = .002", size(medsmall)) yline(1, lcolor(gs10) lpatt(dot)) caption(" ", size(medsmall)))

ttest opmat if alliance==1 & drop==0, by(isis)
cibar opmat if alliance==1 & drop==0, over(isis) level(95) ciopts(lcolor(cranberry)) baropts(lcolor(gs3)) barcolor(gs12 white) graphopts(legend(off) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) ytitle("Material Support") text(.05 1 "AQ", size(medsmall)) text(.05 2 "IS", size(medsmall)) text(.97 1.5 "Diff.= 0.12; P-value = .019", size(medlarge)) yline(1, lcolor(gs10) lpatt(dot)) caption(" ", size(medsmall)))

ttest terrsupp0 if alliance==1 & drop==0, by(isis)
cibar terrsupp0 if alliance==1 & drop==0, over(isis) level(95) ciopts(lcolor(cranberry)) baropts(lcolor(gs3)) barcolor(gs12 white) graphopts(legend(off) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) ytitle("Territorial Support") text(.05 1 "AQ", size(medsmall)) text(.05 2 "IS", size(medsmall)) text(.97 1.5 "Diff.= 0.28; P-value = <.001", size(medlarge)) yline(1, lcolor(gs10) lpatt(dot)) caption(" ", size(medsmall)))

ttest finsupp0 if alliance==1 & drop==0, by(isis)
cibar finsupp0 if alliance==1 & drop==0, over(isis) level(95) ciopts(lcolor(cranberry)) baropts(lcolor(gs3)) barcolor(gs12 white) graphopts(legend(off) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) ytitle("Training Support") text(.05 1 "AQ", size(medsmall)) text(.05 2 "IS", size(medsmall)) text(.97 1.5 "Diff.= 0.04; P-value = .256", size(medlarge)) yline(1, lcolor(gs10) lpatt(dot)) caption(" ", size(medsmall)))

ttest trainsupp0 if alliance==1 & drop==0, by(isis)
cibar trainsupp0 if alliance==1 & drop==0, over(isis) level(95) ciopts(lcolor(cranberry)) baropts(lcolor(gs3)) barcolor(gs12 white) graphopts(legend(off) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) ytitle("Training Support") text(.05 1 "AQ", size(medsmall)) text(.05 2 "IS", size(medsmall)) text(.97 1.5 "Diff.= 0.04; P-value = .256", size(medlarge)) yline(1, lcolor(gs10) lpatt(dot)) caption(" ", size(medsmall)))


********************************************************************************

clear all
